package de.baumann.browser.api.net

import de.baumann.browser.api.net.base.BaseUrl
import de.baumann.browser.api.net.vo.*
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.Headers
import retrofit2.http.POST

@BaseUrl(ApiKey.LICENCE_MODULE)
interface LicenceApiService {

    //licence列表
    @POST(ApiKey.INACTIVE)
    fun licences(): Observable<Result<List<Licence>>>


    @FormUrlEncoded
    @POST(ApiKey.ACTIVATE)
    fun licenceActive(@Field("licence") licence: String): Observable<Result<Any>>

    @FormUrlEncoded
    @POST(ApiKey.TRUNADD)
    fun licenceGives(@Field("count") count: Int,
                     @Field("to_login_name") to_login_name: String): Observable<Result<Any>>

    @FormUrlEncoded
    @POST(ApiKey.TRUNADD)
    fun licenceGift(@Field("lisenceId") lisenceId: String,
                    @Field("to_login_name") to_login_name: String): Observable<Result<Any>>


    @POST(ApiKey.TRUNRECORD)
    fun transList(): Observable<Result<List<Transfer>>>


    @POST(ApiKey.GETFREELISENCE)
    fun getFreeLicence(): Observable<Result<LoginInfo>>


    @FormUrlEncoded
    @POST(ApiKey.LICENCEINFO)
    fun getLicenceStatus(@Field("licence") licence: String): Observable<Result<LoginInfo>>

    @POST(ApiKey.LICENCECOUNT)
    fun getLicenceCount(): Observable<Result<UseableCount>>

    @POST("promotion/rank")
    fun getRank(): Observable<Result<List<Rank>>>


    @FormUrlEncoded
    @POST("http://39.100.65.147:32900/odin/address/selectAddress")
    fun getTransOdinAddress(
            @Field("odinAddress") address: String
    ): Observable<Result<String>>

    @FormUrlEncoded
    @POST("http://39.100.65.147:32900/odin/address/updateAddress")
    fun getTransAddress(
            @Field("odinAddress") odinAddress: String,
            @Field("thorAddress") thorAddress: String,
            @Field("remark") remark: String,
            @Field("remark1") remark1: String,
            @Field("remark2") remark2: String,
            @Field("remark3") remark3: String,
            @Field("remark4") remark4: String,
            @Field("remark5") remark5: String
    ): Observable<Result<Any>>
}